package report;

import java.util.ArrayList;
import java.util.Arrays;
import transfer.OrderReport;

/**
 *
 * @authorI freest
 */
public class OrderReportData extends ReportData{
    
    public OrderReportData(ArrayList data){
        super(data);
    }
    
    public void setTitle(){
        title = "Order Report";
    }
    
    public void setHeaders(){
        String[] stringHeaders = new String[]{
            "Order ID",
            "Order state",
            "Login",
            "Creation date",
            "Delivered date",
            "Warehouse name",
            "Address latitude",
            "Address longtitude",
            "Distance",
            "Cost Commodities",
            "Cost Delivery",
            "Total Cost"};
        headers = new ArrayList();
        headers.addAll(Arrays.asList(stringHeaders));
    }   
    
    /**
     * @param item
     * @return ArrayList of String 
     */
    public ArrayList parseDataItem(Object item){
        ArrayList result = new ArrayList();
        OrderReport orderReport = (OrderReport) item;
        result.add(orderReport.idOrder);
        result.add(orderReport.orderState);
        result.add(orderReport.login);
        result.add(orderReport.creationDate);
        result.add(orderReport.deliveredDate);
        result.add(orderReport.nameWarehouse);
        result.add(orderReport.latitude);
        result.add(orderReport.longitude);
        result.add(orderReport.distance);
        result.add(orderReport.costCommodities);
        result.add(orderReport.costDelivery);
        result.add(orderReport.totalCost);
        return result;
    };
}
